﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ViewListCourse.aspx.cs" Inherits="ViewListCourse" MasterPageFile="../MasterPage.master" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!-- 
        put your code here
        -->
    <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading">
                <h1>IT Courses</h1>
        </div>
        <div class="panel-body">
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM courses, users WHERE courses.teacher_id = users.id"></asp:SqlDataSource>
            <asp:DataList ID="DataList1" runat="server" DataKeyField="id" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" Style="margin-right: 85px" OnItemCommand="DataList1_ItemCommand" Width="100%" OnItemDataBound="DataList1_ItemDataBound">
                <ItemTemplate>
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                <asp:Label ID="course_nameLabel" runat="server" Text='<%# Eval("course_name") %>' Font-Bold="True" Font-Size="X-Large" /></h3>
                        </div>
                        <div class="panel-body">
                            <div class="col-md-10">
                                <p class="courseInfo">
                                    From:
                                    <asp:Label ID="start_dateLabel" runat="server" Text='<%# Eval("start_date", "{0:d}") %>' Font-Bold="True" />
                                    To:
                                    <asp:Label ID="end_dateLabel" runat="server" Text='<%# Eval("end_date", "{0:d}") %>' Font-Bold="True" />
                                </p>
                                <p class="courseInfo">
                                    Teacher:
                        <asp:Label ID="teacherLabel" runat="server" Text='<%# Eval("name") %>' Font-Bold="True"></asp:Label>
                                </p>
                            </div>
                            <div class="col-md-2">
                                <p class="courseCost">
                                    <i class="glyphicon glyphicon-tags"></i> 
                            <asp:Label ID="costLabel" runat="server" Text='<%# Eval("cost") %>' Font-Bold="True" />
                                    <asp:HiddenField ID="hiddenID" runat="server" Value='<%# Eval("id") %>' />
                                </p>
                                <p>
                                    <%  if (Session["logined"] != null && (bool)Session["logined"] == true)
                                        {%>
                                    <asp:Button ID="btnUnSelect" CommandName="UnSelect" runat="server" Text="Remove" CssClass="btn btn-xs btn-warning" />
                                    <asp:Button ID="btnSelect" CommandName="Select" runat="server" Text="Select" CssClass="btn btn-xs btn-success" />
                                    <% } %>
                                    <asp:Button CssClass="btn btn-xs btn-info" ID="Button2" runat="server" Text="Detail" CommandName="Detail" />
                                </p>
                            </div>
                        </div>
                    </div>
                </ItemTemplate>
            </asp:DataList>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="select * from courses"></asp:SqlDataSource>
            <br />
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="head">
    <style type="text/css">
        
        .auto-style6 {
        }

        .auto-style10 {            height: 22px;
        }

        </style>
</asp:Content>
